import './Article.less';

function Article(props) {

    return (
        <div className="Article">
            {(()=>{
                switch(props.type){
                    case 0:
                        return <div>
                            <div className="Article-top"><span>关注了问题</span><span>{props.time}</span></div>
                            <div className="question-title">{props.question.title}</div>
                            <div className="person-info"><img src={props.question.questioner.picture} /><span>{props.question.questioner.name}</span> · <span>{props.question.time}</span></div>
                        </div>;
                        break;
                    case 1:
                        return <div>
                            <div className="Article-top"><span>回答了问题</span><span>{props.time}</span></div>
                            <div className="question-title">{props.question.title}</div>
                            <div className="answer-wrapper">
                                <div className="person-info"><img src={props.question.answer.answerer.picture} /><span>{props.question.answer.answerer.name}</span> · <span>{props.question.answer.time}</span></div>
                                <div className="answer-content">{props.question.answer.answerer.content}</div>
                                <div className="answer-support"><span>赞 {props.question.answer.answerer.support}</span><span>评论 {props.question.answer.answerer.comment}</span></div>
                            </div>
                        </div>;
                        break;
                    case 2:
                        return <div>
                            <div className="Article-top"><span>关注了标签</span><span>{props.time}</span></div>
                            <div className="tag-title"><img src={props.tag.icon} />{props.tag.name}</div>
                            <div className="tag-introduce">{props.tag.introduce}</div>
                        </div>;
                        break;
                    default:
                        return null;
                }
            })()}
        </div>
    );
}

export default Article;